INSTALL_PREFIX ?= /usr

all: libmco.so

libmco.so: mco.c switch-ctx.S
	clang -shared -Wl,-E -fPIC $^ -o $@ 

clean: force
	rm -f a.out libmco.so tags

install: all
	cp libmco.so $(INSTALL_PREFIX)/lib64/libmco.so
	cp mco.h $(INSTALL_PREFIX)/include/mco.h

uninstall: force
	rm -f $(INSTALL_PREFIX)/lib64/libmco.so
	rm -f $(INSTALL_PREFIX)/include/mco.h

test: force
	./run.sh

force:
